package com.hw.dagl.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.hw.dagl.model.Sys_Menu;
import com.hw.dagl.model.Sys_User;
import com.hw.dagl.service.MenuService;
import com.hw.dao.utils.ControllerUtil;

@Controller
public class MenuController extends BaseController{
	
	@Resource
	private MenuService menuServiceImpl;
	
	/*
	 * 根据用户角色ID  查询目录并组�?
	 */
	@RequestMapping(method=RequestMethod.POST)
	public void findRoleMenuTreeByRid(HttpServletRequest request,HttpServletResponse response,String rid,boolean isBuild){
		//Sys_User user = (Sys_User) request.getSession().getAttribute("user");//得到当前登录角色
		List<Sys_Menu> list = menuServiceImpl.findRoleMenuByRid(rid,isBuild);
		ControllerUtil.renderJson(response, list, "encoding:UTF-8","no-cache:false");
	}
}
